<template>
	<view>		
		<view style="height: 160rpx;" class="bg-gradual-orange2">
			<view style="height: 160rpx;width: 100%;display: flex;">
				<view style="height: 60rpx;width: 100%; margin-top: 110rpx;font-size: 32rpx;display: flex;">
					<view style="width: 20%;text-align: center;line-height: 32rpx;" @click="back()">
						<text class="cuIcon-back" style="height: 60rpx;"></text>
						<text> 返回</text>
					</view>
					<view style="width: 56%;text-align: center;line-height: 32rpx;">
						<text>{{ id ? '编辑地址' : '新增地址' }}</text>
					</view>
				</view>
			</view>
		</view>
		<AddressEdit :addressId="id" from="order" @success="saveSuccess"></AddressEdit>
	</view>
</template>

<script>
	import AddressEdit from '../../components/address/edit.vue'
	export default {
		components: {
			AddressEdit
		},
		props: ['addressId'],
		data() {
			return {
				id: ''
			}
		},
		mounted() {
			this.id = this.addressId
		},
		methods: {
			back() {
				this.$emit('back')
			},
			// 保存成功
			saveSuccess() {
				this.$emit('success')
			}
		},
		watch: {
			addressId(val) {
				this.id = val
			}
		}
	}
</script>

<style lang="less" scoped>
	.bg-gradual-orange2 {
		background-image: linear-gradient(45deg, #FF707A, #FD505C);
		color: #ffffff;
	}

	.line-orange2 {
		color: #FF707A;
	}
</style>
